<?php
include("header.php");
if($_SESSION['user_level'] != 1 OR (!$_SESSION['signed_in']))
{
header("location: redirect.php");
}
else
 {
$pageTitle = "Unban";
if (mysql_real_escape_string($_GET['unban'])!="" AND mysql_real_escape_string($_GET['unbanip'])=="")
{
$result = mysql_query("DELETE FROM ".$table_prefix."banlist WHERE ban_userid =".mysql_real_escape_string($_GET['unban'])."");
$result2 = mysql_query("UPDATE ".$table_prefix."users SET is_banned = 0 WHERE user_id = ".mysql_real_escape_string($_GET['unban'])."");
if(!$result) {echo "<div align='center'>Error! User is not unbanned!</div>";}
else
{echo "<div align='center'><b>User successfully unbanned!</b><br /><br /><a href='bans.php'>Back to previous page</a></div>";}
}
else
{
if (mysql_real_escape_string($_GET['unbanip'])!="")
{
$result = mysql_query("DELETE FROM ".$table_prefix."banlist WHERE ban_ip ='".mysql_real_escape_string($_GET['unbanip'])."' AND ban_userid = ''");
if(!$result) {echo "<div align='center'>Error! User is not unbanned!</div>";}
else
{echo "<div align='center'><b>".mysql_real_escape_string($_GET['unbanip'])." successfully unbanned!</b><br /><br /><a href='bans.php'>Back to previous page</a></div>";}
}
}
}

$pageTitle = "Bans";
$pageContents = ob_get_contents ();
ob_end_clean ();
echo str_replace ('<!--TITLE-->', $pageTitle, $pageContents);  